package com.lindenvalley.ch;

import java.util.TimerTask;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class NotificationTask extends TimerTask {
	
	private Notification notification;
	private NotificationManager mNotificationManager;


	public NotificationTask(Context mContext) {
		super();
		mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
		notification = new Notification(R.drawable.icon, mContext.getString(R.string.notification), System.currentTimeMillis());
		Context context = mContext.getApplicationContext();
		CharSequence contentTitle = mContext.getString(R.string.app_name);
		CharSequence contentText = mContext.getString(R.string.notification);
		Intent notificationIntent = new Intent(mContext, SignUpActivity.class);
		PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, notificationIntent, 0);
		notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
		notification.flags = Notification.FLAG_AUTO_CANCEL;

	}

	@Override
	public void run() {
		// TODO Auto-generated method stub
		Log.i("TASK", "---------------- EXECUTE");
		
		mNotificationManager.notify(1, notification);


	}

}
